// @ts-nocheck
import FormUserCenterPreview from './FormUserCenterPreview.vue';
import FormUserCenterSetting from './FormUserCenterSetting.vue';

import { getSetting } from '@src/mform/util'
import Vue from 'vue';

let FormUserCenterField = {
  formType: 'userCenter', // 字段类型
  name: '个人中心',
  isSystem: 0,
  forceDelete: false,
  component: {
    setting: FormUserCenterSetting,
    preview: FormUserCenterPreview,
  },
  packFunction: pack,
  unPackFunction: unpack,
  validateFunction: validate,
}

export function pack(field) {  
  let originSetting = getSetting(field.setting)
  
  const setting = {
    background_picture: originSetting.backgroundUrl,
  }
  
  Vue.set(field, 'setting', setting)
}

export function unpack(field) {
  let originSetting = getSetting(field.setting)
  
  const setting = {
    backgroundUrl: originSetting.background_picture,
  }
  
  Vue.set(field, 'setting', setting)
}

export function validate(field) {
  
}

export default FormUserCenterField;
